1 package org.smartcomps.twister.worklist;
2
3 import junit.framework.TestCase;
4
5 import net.sf.hibernate.tool.hbm2ddl.SchemaExport;
6 import net.sf.hibernate.cfg.Configuration;
7
8 import org.smartcomps.twister.common.transaction.TransactionManager;
9 import org.smartcomps.twister.common.lifecycle.LifecycleManager;
10
11 import org.dom4j.Element;
12 import org.dom4j.Document;
13 import org.dom4j.DocumentHelper;
14
15 import java.util.Calendar;
16
17 import com.sun.msv.datatype.xsd.DatatypeFactory;
18
19 /***
20 * Tests the WorkList interface
21 */
22 public class TestWorkList extends TestCase {
23
24 private TwisterWorkList workList = TwisterWorkListFactory.getWorkList();
25
26 protected void setUp() throws Exception {
27 LifecycleManager.getLifecycleManager().createResources();
28 LifecycleManager.getLifecycleManager().startResources();
29
30 SchemaExport schemaExport = new SchemaExport(new Configuration().configure());
31 schemaExport.create(true, true);
32 }
33
34 protected void tearDown() throws Exception {
35 LifecycleManager.getLifecycleManager().stopResources();
36 LifecycleManager.getLifecycleManager().destroyResources();
37 }
38
39 public void testCreate() throws Exception {
40 Document doc = DocumentHelper.createDocument();
41 Element testElmt = doc.addElement("message").addElement("wipart");
42 Element userElmt = testElmt.addElement("user");
43 userElmt.addText("bob");
44 Element descElmt = testElmt.addElement("description");
45 descElmt.addText("nod smartly");
46 Element deadlineElmt = testElmt.addElement("deadline");
47 deadlineElmt.setText(DatatypeFactory.getTypeByName("dateTime")
48 .serializeJavaObject(Calendar.getInstance(), null));
49
50 // XMLWriter writer = new XMLWriter(System.out);
51 // writer.write(doc);
52 // writer.flush();
53
54 workList.createWorkItem(doc);
55 }
56 }
This page was automatically generated by Maven